/*
 *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
 *
 *  Redistribution and use in source and binary forms, with or without
 *  modification, are permitted provided that the following conditions are met:
 *
 *  Redistributions of source code must retain the above copyright notice,
 *  this list of conditions and the following disclaimer.
 *  Redistributions in binary form must reproduce the above copyright
 *  notice, this list of conditions and the following disclaimer in the
 *  documentation and/or other materials provided with the distribution.
 *  Neither the name of the dreamlu.net developer nor the names of its
 *  contributors may be used to endorse or promote products derived from
 *  this software without specific prior written permission.
 *  Author: Chill 庄骞 (smallchill@163.com)
 */
package org.springblade.modules.repair.service.impl;

import org.springblade.modules.repair.entity.PlanCheckHistoryScore;
import org.springblade.modules.repair.vo.PlanCheckHistoryScoreVO;
import org.springblade.modules.repair.mapper.PlanCheckHistoryScoreMapper;
import org.springblade.modules.repair.service.IPlanCheckHistoryScoreService;
import org.springblade.core.mp.base.BaseServiceImpl;
import org.springblade.modules.repair.vo.plan.store.ByWorkScoreInfoVo;
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.core.metadata.IPage;

import java.util.List;

/**
 * 工作项评分记录 服务实现类
 *
 * @author ysq
 * @since 2024-01-17
 */
@Service
public class PlanCheckHistoryScoreServiceImpl extends BaseServiceImpl<PlanCheckHistoryScoreMapper, PlanCheckHistoryScore> implements IPlanCheckHistoryScoreService {

	@Override
	public IPage<PlanCheckHistoryScoreVO> selectPlanCheckHistoryScorePage(IPage<PlanCheckHistoryScoreVO> page, PlanCheckHistoryScoreVO planCheckHistoryScore) {
		return page.setRecords(baseMapper.selectPlanCheckHistoryScorePage(page, planCheckHistoryScore));
	}

	@Override
	public List<ByWorkScoreInfoVo> getByWorkScoreInfo(Long planId) {
		List<ByWorkScoreInfoVo> byWorkScoreInfo1 = baseMapper.getByWorkScoreInfo(planId);
		List<ByWorkScoreInfoVo> byWorkScoreInfo2 = baseMapper.getByWorkScoreInfoOfWx(planId);
		if (byWorkScoreInfo1.size() > 0) {
			byWorkScoreInfo1.addAll(byWorkScoreInfo2);
			return byWorkScoreInfo1;
		}
		return byWorkScoreInfo2;
	}
}
